using Services;
using UnityEngine;

public class ContainerUI : MonoBehaviour
{
    protected ContainerUI_Manager manager;
    protected Container container;
    protected EventSystem eventSystem;
    protected Player player;

    protected virtual void Awake()
    {
        eventSystem = ServiceLocator.Get<EventSystem>();
        manager = GetComponentInParent<ContainerUI_Manager>();
        manager.VisibleChange += OnVisibleChange;
    }

    protected virtual void Start()
    {
        player = ServiceLocator.Get<ActionController>().player;
    }

    protected virtual void OnVisibleChange(bool visible)
    {
        if (visible)
            container = manager.Container;
    }
}
